#include<stdio.h>
#include<malloc.h>

typedef struct n node;
struct n{int data;node* next;};


// returns a pointer of a new node with assigned data
node* node_new(int d){
    node* n = malloc(sizeof(node));
    n->data = d;
    n->next = NULL;
    return n;
}

// add node to end
void node_append(node* head,node* ap){
    while(head->next!=NULL)head=head->next;
    head->next = ap;
    ap->next = NULL;
}

// delete the k-th node after the given pointer
node* node_pop(node* head,int k){
    
}


// free for cyclic list
void circle_free(node* head){
    node* a = head;
    node* b;
    while(a->next!=head){b=a->next;free(a);a=b;}
}


int main(){
    int n,m,k;
    printf("Josephu Solver. Enter n,m,k, saperated by white spaces: ");
    scanf("%d%d%d",&n,&m,&k);
    node* head = node_new(0);
    for(int i = 1;i<=n;i++)node_append(head,node_new(i));
    
}